package org.grow.jpago.exception;

import org.springframework.http.ResponseEntity;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author: xwg
 * @CreateDate: 21-7-14
 */

@RestControllerAdvice
public class ExceptionBridge {
    @ExceptionHandler(value = ObjectOptimisticLockingFailureException.class)
    public ResponseEntity<String> optLock( ObjectOptimisticLockingFailureException e){
        System.out.println(e.getMessage());
        return new ResponseEntity<>("乐观锁异常，请用户重新查询尝试",null,1024);
    }
}
